package com.cafuc.base;

import java.io.*;

public class ExceptionOperation {

    public void exceptionTest() {
//        double a = 1 /0;
        File file;
        InputStream is = null;
        try {
            is = new FileInputStream("C:\\Users\\gubler\\Desktop\\java.txt");
        } catch (FileNotFoundException e) {
            e.printStackTrace();
        } finally {
            try {
                if (is != null) {
                    is.close();
                }
            } catch (IOException e) {
                e.printStackTrace();
            }
        }
    }

    public void exceptionTest2() throws Exception {
        throw new Exception("抛出一个异常");
    }

    public static void main(String[] args) throws Exception {
        ExceptionOperation eo = new ExceptionOperation();
        eo.exceptionTest();
        eo.exceptionTest2();

    }
}
